package com.road7.mina.customCodec;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

import com.road7.mina.customCodec.protobuf.ProtobufStrictDecoder;
import com.road7.mina.customCodec.protobuf.ProtobufStrictEncoder;

/**
 * @Description :自定义实现Server/Client端的编解码工厂（自定义编码与解码器）！
 * @FileName: ProtobufStrictCodecFactory.java
 * @Author :WeiHui.Zhang
 * @Data : 2015年11月19日 下午9:18:46
 * @Version:V1.00
 */
public class ProtobufStrictCodecFactory implements ProtocolCodecFactory {

	private final ProtobufStrictEncoder encoder;
	private final ProtobufStrictDecoder decoder;

	public ProtobufStrictCodecFactory() {
		encoder = new ProtobufStrictEncoder();
		decoder = new ProtobufStrictDecoder();
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		return encoder;
	}

	@Override
	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		return decoder;
	}

}
